<?php
	include_once("king_head.php");
?>
<?php
	include_once("ClsSebent/config.php");
	$action=$_REQUEST['action'];
	if($action=="Save" && $_SESSION['SITE_ID'] != "")
	{
		//echo $company_name."<BR>";
		$company_name=str_replace("\'","''",$company_name);//Script will work with \' on server and with only ' on local. so while running at local remove \ sign off \'.
		//echo $company_name_img_alt."<BR>";
		$company_name_img_alt=str_replace("\'","''",$company_name_img_alt);
		//echo $slogan."<BR>";
		$slogan=str_replace("\'","''",$slogan);
		//echo $contact_info."<BR>";
		$contact_info=str_replace("\'","''",$contact_info);
		//echo $copyright."<BR>";
		$copyright=str_replace("\'","''",$copyright);

		$sql="UPDATE site_home SET company_name='".$company_name."', company_name_img_alt='".$company_name_img_alt."', slogan='".$slogan."', contact_info='".$contact_info."', copyright='".$copyright."'";
//		echo $sql;

	    if (isset($company_name_img) && $company_name_img != "") 
			{
			if(!copy($company_name_img,"./photos/${site_id}_" . $company_name_img_name))
				{ echo "coping error!"; exit;}
			$company_name_img_name=str_replace("\'","''",$company_name_img_name);
			$sql=$sql . ", company_name_img='".$company_name_img_name."' ";			
			}
		$sql=$sql . " WHERE id='".$_SESSION['SITE_ID']."'";
		//echo "<pre>".$sql."</pre><BR>";
		mysql_query($sql);
	}
	/*if("$rem_img"=="y" && $_SESSION['SITE_ID'] != "" ){
		$sql="UPDATE site_home SET  company_name_img='' WHERE id=$_SESSION['SITE_ID']";
		echo $sql."<BR>";
		mysql_query($sql);
		$flag="n";
	}*/

	$sql="SELECT * FROM site_home WHERE id='".$_SESSION['SITE_ID']."'";

	$result = mysql_query($sql);
	if($row=mysql_fetch_array($result)){
		$company_name=$row["company_name"];
		$company_name_img=$row["company_name_img"];
		$company_name_img_alt=$row["company_name_img_alt"];
		$slogan=$row["slogan"];
		$contact_info=$row["contact_info"];
		$copyright=$row["copyright"];		
	}
?>
<CENTER>
<H2> Company-contact Control Panel</H2>
<form enctype="multipart/form-data"  method="post" name="frm">
<link id="skin_css" href="hardcore/webeditor/webeditor.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="hardcore/webeditor/webeditor.js"></script>
<script type="text/javascript">
<!--
// This example web page and its content images are located in the same folder as the web content editor program files so image URLs etc. should not be "shortened"
webeditor.shortenLocalURLsSearch = false;
webeditor.shortenLocalURLsPath = false;
webeditor.shortenLocalURLsBase = false;
// -->

<!--
HardCoreWebEditorToolbar();
// -->
</script>
<input type=hidden name=site_id value="<?php echo $_SESSION['SITE_ID']; ?>">
<TABLE width="100%">
<TR><td>Company Name</td><td height="35">
<script type="text/javascript">
<!--
company_name = '<?php echo str_replace("SCRIPT", "SCR'+'IPT", str_replace("script", "scr'+'ipt", str_replace("\t", "\\t", str_replace("\n", "\\n", str_replace("\r", "\\r", str_replace("'", "\'", str_replace("</", "<\/", str_replace("\\", "\\\\", $company_name)))))))); ?>';
content_editor = new HardCoreWebEditor('hardcore/webeditor/', '', 'company_name', company_name, '', 'hardcore/webeditor/hardcore1.css', true, 'manager', '', '', '', '', '', '', '', 'html', '');
// -->
</script>
</td></tr>
<tr><td>Company name image<BR>(size ~ 150x500px) </td><td><input type=file name=company_name_img value="<?php echo $company_name_img; ?>" size=40> &nbsp;  
	<?php if("$company_name_img" !=""){ ?><a href="photos/<?php echo $_SESSION['SITE_ID'] . "_" . $company_name_img; ?>" target="_n1">View current name image</a>&nbsp;&nbsp;<a href='rem_img.php?site_id=<?php echo $_SESSION['SITE_ID']; ?>&img=<?php echo $company_name_img;?>'>Remove Image</a><?php } else echo "No existing image"; ?></td></tr>
<tr><td>Company name image alt </td><td><input name=company_name_img_alt value="<?php echo $company_name_img_alt; ?>" size=40></td></tr>
<tr><td>Slogan</td><td height="50">
<script type="text/javascript">
<!--
slogan = '<?php echo str_replace("SCRIPT", "SCR'+'IPT", str_replace("script", "scr'+'ipt", str_replace("\t", "\\t", str_replace("\n", "\\n", str_replace("\r", "\\r", str_replace("'", "\'", str_replace("</", "<\/", str_replace("\\", "\\\\", $slogan)))))))); ?>';
content_editor = new HardCoreWebEditor('hardcore/webeditor/', '', 'slogan', slogan, '', 'hardcore/webeditor/hardcore1.css', true, 'manager', '', '', '', '', '', '', '', 'html', '');
// -->
</script>
</td></tr>
<tr><td>Contact info</td><td>
<script type="text/javascript">
<!--
contact_info = '<?php echo str_replace("SCRIPT", "SCR'+'IPT", str_replace("script", "scr'+'ipt", str_replace("\t", "\\t", str_replace("\n", "\\n", str_replace("\r", "\\r", str_replace("'", "\'", str_replace("</", "<\/", str_replace("\\", "\\\\", $contact_info)))))))); ?>';
content_editor = new HardCoreWebEditor('hardcore/webeditor/', '', 'contact_info', contact_info, '', 'hardcore/webeditor/hardcore1.css', true, 'manager', '', '', '', '', '', '', '', 'html', '');
// -->
</script>
</td></tr>
<tr><td>Copyright Message</td><td height="20">
<script type="text/javascript">
<!--
copyright = '<?php echo str_replace("SCRIPT", "SCR'+'IPT", str_replace("script", "scr'+'ipt", str_replace("\t", "\\t", str_replace("\n", "\\n", str_replace("\r", "\\r", str_replace("'", "\'", str_replace("</", "<\/", str_replace("\\", "\\\\", $copyright)))))))); ?>';
content_editor = new HardCoreWebEditor('hardcore/webeditor/', '', 'copyright', copyright, '', 'hardcore/webeditor/hardcore1.css', true, 'manager', '', '', '', '', '', '', '', 'html', '');
// -->
</script>
<script type="text/javascript">
<!--
HardCoreWebEditorDOMInspector();
// -->
</script>
</td></tr>
<tr><td colspan=2 align=center><input type=submit name=action value=Save></TD>
</TR>
</TABLE></form>
</CENTER>

<?php
	include_once("king_foot.php");
?>